package site.shihuan.helpdesk.service.manager;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import site.shihuan.helpdesk.common.util.IdWorker;
import site.shihuan.helpdesk.service.dao.SvcHiMsgDao;
import site.shihuan.helpdesk.service.model.Constants;
import site.shihuan.helpdesk.service.model.po.SvcHiMsgPO;

import java.util.Collections;
import java.util.List;

/**
 * 消息业务层
 *
 * @author 周世焕
 * @Date 2021/2/23 16:10
 */
@Slf4j
@Component
public class MessageManager {

    private static final int msgLimit = 1000;

    @Autowired
    private SvcHiMsgDao svcHiMsgDao;

    public List<SvcHiMsgPO> findMsgHistory(String contactId, int start){
        List<SvcHiMsgPO> list = svcHiMsgDao.selectMsgBatch(contactId,start,msgLimit);
        Collections.reverse(list);
        return list;
    }
}
